package com.ostrich.module_home.daily.adapter

import com.chad.library.adapter.base.BaseProviderMultiAdapter
import com.ostrich.module_home.R
import com.ostrich.module_home.daily.adapter.provider.DailyItemType
import com.ostrich.module_home.daily.adapter.provider.EmptyProvider
import com.ostrich.module_home.daily.adapter.provider.FollowCardProvider
import com.ostrich.module_home.daily.adapter.provider.TextCardProvider
import com.ostrich.module_home.daily.entity.DailyEntity

/**
 * @Author : yaotianxue
 * @Time : On 2023/10/30 14:04
 * @Description : DailyAdpter
 */
class DailyAdapter:BaseProviderMultiAdapter<DailyEntity>() {
    init {
        addItemProvider(TextCardProvider(DailyItemType.TEXT_CARD_VIEW, R.layout.home_item_daily_single_title_view))
        addItemProvider(FollowCardProvider(DailyItemType.FOLLOW_CARD_VIEW, R.layout.home_item_daily_follow_card_view))
        addItemProvider(EmptyProvider(DailyItemType.EMPTY_CARD_VIEW, R.layout.home_item_empty))
    }
    override fun getItemType(data: List<DailyEntity>, position: Int): Int {
        return when(data[position].type){
            "textCard" -> DailyItemType.TEXT_CARD_VIEW
            "followCard" -> DailyItemType.FOLLOW_CARD_VIEW
            else -> DailyItemType.EMPTY_CARD_VIEW

        }
    }
}